package com.cms.jy.draft.util;

import com.cms.jy.draft.entity.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.IOException;

/**
 * 草稿配置读取工具类
 */
public class DraftConfigReader {
    
    private static final ObjectMapper objectMapper = new ObjectMapper();
    
    /**
     * 读取草稿内容配置
     * @param filePath 文件路径
     * @return DraftContent 对象
     * @throws IOException IO异常
     */
    public static DraftContent readDraftContent(String filePath) throws IOException {
        return objectMapper.readValue(new File(filePath), DraftContent.class);
    }
    
    /**
     * 读取草稿元信息配置
     * @param filePath 文件路径
     * @return DraftMetaInfo 对象
     * @throws IOException IO异常
     */
    public static DraftMetaInfo readDraftMetaInfo(String filePath) throws IOException {
        return objectMapper.readValue(new File(filePath), DraftMetaInfo.class);
    }
    
    /**
     * 读取草稿代理配置
     * @param filePath 文件路径
     * @return DraftAgencyConfig 对象
     * @throws IOException IO异常
     */
    public static DraftAgencyConfig readDraftAgencyConfig(String filePath) throws IOException {
        return objectMapper.readValue(new File(filePath), DraftAgencyConfig.class);
    }
    
    /**
     * 读取草稿虚拟存储配置
     * @param filePath 文件路径
     * @return DraftVirtualStore 对象
     * @throws IOException IO异常
     */
    public static DraftVirtualStore readDraftVirtualStore(String filePath) throws IOException {
        return objectMapper.readValue(new File(filePath), DraftVirtualStore.class);
    }
    
    /**
     * 读取草稿设置配置
     * @param filePath 文件路径
     * @return DraftSettings 对象
     * @throws IOException IO异常
     */
    public static DraftSettings readDraftSettings(String filePath) throws IOException {
        return DraftSettingsReader.readDraftSettings(filePath);
    }
}